Full source code website bán hàng thương mại điện tử gần giống shopee
468.907 lượt xem;
1 <?
2 if (isset($_POST['butSaveLoai'])) {
3 $name=$_POST['txtName'];
4 $status=($_POST['chkShow']!=''?1:0);
5 $parent=$_POST['txtParent'];
6 $content=$_POST['txtContent'];
7
8 $name = trim($_POST['txtName']);
9 if ($name=="")
10 {
11 echo "<p align=center class='err'>Bạn chưa nhập tên danh mục</p>";
12 }
13 else
14 {
15 if (!empty($_POST['oldid'])) {
16 $oldid = $_POST['oldid'];
17 $sql = "update album_categories set album_categories_name='".$name."', album_categories_status='".$status."', album_categories_parentid='".$parent."', album_categories_desc='".$content."' where album_categories_id='".$oldid."'";
18 }
19 else
20 $sql = "insert into album_categories (album_categories_name,album_categories_parentid,album_categories_status,album_categories_desc,date_added) values ('".$name."',".$parent.",".$status.",'".$content."',SYSDATE())";
21 if (mysql_query($sql,$con)) {
22 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
23 echo "<script>window.location='index.php?act=album_category&page=".$_REQUEST['page']."&code=1'</script>";
24 }
25 else echo "<p align=center class='err'>Không thể cập nhật</p>";
26
27 }
28 }
29 ?>
30
31 <?
32 if (isset($_GET['id'])) {
33 $oldid=$_GET['id'];
34 $sql = "select * from album_categories where album_categories_id='".$oldid."'";
35 if ($result = mysql_query($sql,$con)) {
36 $row=mysql_fetch_array($result);
37 $name=$row['album_categories_name'];
38 $status=$row['album_categories_status'];
39 $parent=$row['album_categories_parentid'];
40 $content=$row['album_categories_desc'];
41 }
42 }
43 ?>
44 <script language="Javascript1.2"><!-- // load htmlarea
45 _editor_url = "htmlarea/"; // URL to htmlarea files
46 var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
47 if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
48 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
49 if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
50 if (win_ie_ver >= 5.5) {
51 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
52 document.write(' language="Javascript1.2"></scr' + 'ipt>');
53 } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
54 // --></script>
55
56 <form method="POST" action="index.php?">
57 <input type=hidden name="act" value="album_category_m">
58 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
59 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
60 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
61 <tr>
62 <td width="45%" height="20" class="title" align="center">Thêm mới / Cập nhật : Danh mục hình ảnh</td>
63 </tr>
64 <tr>
65 <td width="45%">
66 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
67 <tr>
68 <td width="15%" class="smallfont">
69 <p align="right">Tên danh mục</td>
70 <td width="1%" class="smallfont">
71 <font color="#FF0000">*</font></td>
72 <td width="83%" class="smallfont">
73 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
74 </tr>
75 <tr>
76 <td width="15%" class="smallfont" align="right">
77 Không cho hiển thị</td>
78 <td width="1%" class="smallfont">
79 </td>
80 <td width="83%" class="smallfont">
81 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
82 </tr>
83 <tr>
84 <td width="15%" class="smallfont">
85 <p align="right">Thuộc danh mục</td>
86 <td width="1%" class="smallfont">
87 </td>
88 <td width="83%" class="smallfont">
89 <select size="1" name="txtParent">
90 <?
91 echo "<option value='0'>[Danh mục gốc]</option>";
92 $cats=GetListAlbumCategory(""," ");
93 foreach ($cats as $cat)
94 {
95 if ($cat[0]==$parent)
96 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
97 else
98 echo "<option value=".$cat[0].">".$cat[1]."</option>";
99 }
100 ?>
101 </select>
102
103 </td>
104 </tr>
105 <tr>
106 <td width="15%" class="smallfont" align="right" valign="top">
107 Nội dung</td>
108 <td width="1%" class="smallfont">
109 </td>
110 <td width="83%" class="smallfont">
111 <textarea rows="6" name="txtContent" cols="28"><? echo $content; ?></textarea>
112 <script language="javascript1.2" defer>
113 var config = new Object(); // create new config object
114
115 config.width = "640";
116 config.height = "350px";
117 config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
118 config.debug = 0;
119
120 // NOTE: You can remove any of these blocks and use the default config!
121
122 config.toolbar = [
123 ['fontname'],
124 ['fontsize'],
125 ['fontstyle'],
126 ['linebreak'],
127 ['bold','italic','underline','separator'],
128 ['strikethrough','subscript','superscript','separator'],
129 ['justifyleft','justifycenter','justifyright','separator'],
130 ['OrderedList','UnOrderedList','Outdent','Indent','separator'],
131 ['forecolor','backcolor','separator'],
132 ['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
133 ['popupeditor'],
134 ];
135
136 config.fontnames = {
137 "Arial": "arial, helvetica, sans-serif",
138 "Courier New": "courier new, courier, mono",
139 "Georgia": "Georgia, Times New Roman, Times, Serif",
140 "Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
141 "Times New Roman": "times new roman, times, serif",
142 "Verdana": "Verdana, Arial, Helvetica, sans-serif",
143 "impact": "impact",
144 "WingDings": "WingDings"
145 };
146
147 config.fontsizes = {
148 "1 (8 pt)": "1",
149 "2 (10 pt)": "2",
150 "3 (12 pt)": "3",
151 "4 (14 pt)": "4",
152 "5 (18 pt)": "5",
153 "6 (24 pt)": "6",
154 "7 (36 pt)": "7"
155 };
156
157 //config.stylesheet = "http://www.domain.com/sample.css";
158
159 config.fontstyles = [ // make sure classNames are defined in the page the content is being display as well in or they won't work!
160 { name: "headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
161 { name: "arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
162 { name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
163
164 // leave classStyle blank if it's defined in config.stylesheet (above), like this:
165 // { name: "verdana blue", className: "headline4", classStyle: "" }
166 ];
167
168 editor_generate('txtContent', config);
169 </script>
170
171 </td>
172 </tr>
173 <tr>
174 <td width="15%" class="smallfont">
175 <p align="right"><INPUT TYPE="submit" NAME="butSaveLoai" VALUE=" Lưu " CLASS=button> </td>
176 <td width="1%" class="smallfont">
177 </td>
178 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button></td>
179 </tr>
180
181 </table>
182 </td>
183 </tr>
184 </table>
185 </form>
2 if (isset($_POST['butSaveLoai'])) {
3 $name=$_POST['txtName'];
4 $status=($_POST['chkShow']!=''?1:0);
5 $parent=$_POST['txtParent'];
6 $content=$_POST['txtContent'];
7
8 $name = trim($_POST['txtName']);
9 if ($name=="")
10 {
11 echo "<p align=center class='err'>Bạn chưa nhập tên danh mục</p>";
12 }
13 else
14 {
15 if (!empty($_POST['oldid'])) {
16 $oldid = $_POST['oldid'];
17 $sql = "update album_categories set album_categories_name='".$name."', album_categories_status='".$status."', album_categories_parentid='".$parent."', album_categories_desc='".$content."' where album_categories_id='".$oldid."'";
18 }
19 else
20 $sql = "insert into album_categories (album_categories_name,album_categories_parentid,album_categories_status,album_categories_desc,date_added) values ('".$name."',".$parent.",".$status.",'".$content."',SYSDATE())";
21 if (mysql_query($sql,$con)) {
22 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
23 echo "<script>window.location='index.php?act=album_category&page=".$_REQUEST['page']."&code=1'</script>";
24 }
25 else echo "<p align=center class='err'>Không thể cập nhật</p>";
26
27 }
28 }
29 ?>
30
31 <?
32 if (isset($_GET['id'])) {
33 $oldid=$_GET['id'];
34 $sql = "select * from album_categories where album_categories_id='".$oldid."'";
35 if ($result = mysql_query($sql,$con)) {
36 $row=mysql_fetch_array($result);
37 $name=$row['album_categories_name'];
38 $status=$row['album_categories_status'];
39 $parent=$row['album_categories_parentid'];
40 $content=$row['album_categories_desc'];
41 }
42 }
43 ?>
44 <script language="Javascript1.2"><!-- // load htmlarea
45 _editor_url = "htmlarea/"; // URL to htmlarea files
46 var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
47 if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
48 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
49 if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
50 if (win_ie_ver >= 5.5) {
51 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
52 document.write(' language="Javascript1.2"></scr' + 'ipt>');
53 } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
54 // --></script>
55
56 <form method="POST" action="index.php?">
57 <input type=hidden name="act" value="album_category_m">
58 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
59 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
60 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
61 <tr>
62 <td width="45%" height="20" class="title" align="center">Thêm mới / Cập nhật : Danh mục hình ảnh</td>
63 </tr>
64 <tr>
65 <td width="45%">
66 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
67 <tr>
68 <td width="15%" class="smallfont">
69 <p align="right">Tên danh mục</td>
70 <td width="1%" class="smallfont">
71 <font color="#FF0000">*</font></td>
72 <td width="83%" class="smallfont">
73 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
74 </tr>
75 <tr>
76 <td width="15%" class="smallfont" align="right">
77 Không cho hiển thị</td>
78 <td width="1%" class="smallfont">
79 </td>
80 <td width="83%" class="smallfont">
81 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
82 </tr>
83 <tr>
84 <td width="15%" class="smallfont">
85 <p align="right">Thuộc danh mục</td>
86 <td width="1%" class="smallfont">
87 </td>
88 <td width="83%" class="smallfont">
89 <select size="1" name="txtParent">
90 <?
91 echo "<option value='0'>[Danh mục gốc]</option>";
92 $cats=GetListAlbumCategory(""," ");
93 foreach ($cats as $cat)
94 {
95 if ($cat[0]==$parent)
96 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
97 else
98 echo "<option value=".$cat[0].">".$cat[1]."</option>";
99 }
100 ?>
101 </select>
102
103 </td>
104 </tr>
105 <tr>
106 <td width="15%" class="smallfont" align="right" valign="top">
107 Nội dung</td>
108 <td width="1%" class="smallfont">
109 </td>
110 <td width="83%" class="smallfont">
111 <textarea rows="6" name="txtContent" cols="28"><? echo $content; ?></textarea>
112 <script language="javascript1.2" defer>
113 var config = new Object(); // create new config object
114
115 config.width = "640";
116 config.height = "350px";
117 config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
118 config.debug = 0;
119
120 // NOTE: You can remove any of these blocks and use the default config!
121
122 config.toolbar = [
123 ['fontname'],
124 ['fontsize'],
125 ['fontstyle'],
126 ['linebreak'],
127 ['bold','italic','underline','separator'],
128 ['strikethrough','subscript','superscript','separator'],
129 ['justifyleft','justifycenter','justifyright','separator'],
130 ['OrderedList','UnOrderedList','Outdent','Indent','separator'],
131 ['forecolor','backcolor','separator'],
132 ['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
133 ['popupeditor'],
134 ];
135
136 config.fontnames = {
137 "Arial": "arial, helvetica, sans-serif",
138 "Courier New": "courier new, courier, mono",
139 "Georgia": "Georgia, Times New Roman, Times, Serif",
140 "Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
141 "Times New Roman": "times new roman, times, serif",
142 "Verdana": "Verdana, Arial, Helvetica, sans-serif",
143 "impact": "impact",
144 "WingDings": "WingDings"
145 };
146
147 config.fontsizes = {
148 "1 (8 pt)": "1",
149 "2 (10 pt)": "2",
150 "3 (12 pt)": "3",
151 "4 (14 pt)": "4",
152 "5 (18 pt)": "5",
153 "6 (24 pt)": "6",
154 "7 (36 pt)": "7"
155 };
156
157 //config.stylesheet = "http://www.domain.com/sample.css";
158
159 config.fontstyles = [ // make sure classNames are defined in the page the content is being display as well in or they won't work!
160 { name: "headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
161 { name: "arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
162 { name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
163
164 // leave classStyle blank if it's defined in config.stylesheet (above), like this:
165 // { name: "verdana blue", className: "headline4", classStyle: "" }
166 ];
167
168 editor_generate('txtContent', config);
169 </script>
170
171 </td>
172 </tr>
173 <tr>
174 <td width="15%" class="smallfont">
175 <p align="right"><INPUT TYPE="submit" NAME="butSaveLoai" VALUE=" Lưu " CLASS=button> </td>
176 <td width="1%" class="smallfont">
177 </td>
178 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button></td>
179 </tr>
180
181 </table>
182 </td>
183 </tr>
184 </table>
185 </form>